<%--
 * list.jsp
 *
 * Copyright (C) 2013 Universidad de Sevilla
 * 
 * The use of this project is hereby constrained to the conditions of the 
 * TDG Licence, a copy of which you may download from 
 * http://www.tdg-seville.info/License.html
 --%>

<%@page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>

<%@taglib prefix="jstl" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@taglib prefix="security"
	uri="http://www.springframework.org/security/tags"%>
<%@taglib prefix="display" uri="http://displaytag.sf.net"%>
<%@taglib prefix="acme" tagdir="/WEB-INF/tags" %>


<display:table pagesize="5" class="displaytag" 
	name="challenges" id="row" requestURI="${requestURI}">	

	<spring:message code="challenge.title" var="titleHeader"/>
	<display:column property="title" title="${titleHeader}"/>	
	
	<spring:message code="challenge.description" var="descriptionHeader" />
	<display:column property="description" title="${descriptionHeader}" />
	
	<spring:message code="challenge.result" var="resultHeader" />
	<display:column property="result" title="${resultHeader}" />
	
	<security:authorize access="hasRole('ADMINISTRATOR')">
		<jstl:if test = "${eventOwner && eventNotStarted}">
			<display:column>
				<a href="challenge/administrator/edit.do?challengeId=${row.id}">
					<spring:message	code="challenge.edit" />
				</a>
			</display:column>	
		</jstl:if>
	</security:authorize>
	
</display:table>
<!-- Action links -->

	<security:authorize access="hasRole('ADMINISTRATOR')">
		<jstl:if test = "${eventNotStarted && eventOwner}">
		<a href="challenge/administrator/create.do?eventId=${eventId}">
			<spring:message code="challenge.create" />
		</a>	
		</jstl:if>				
	</security:authorize>
	
	<security:authorize access="hasRole('ADMINISTRATOR')">
		<acme:cancel code="challenge.goBack" url="${backURI}" />
	</security:authorize>
	
	<security:authorize access="hasRole('PARTICIPANT')">
		<acme:cancel code="challenge.goBack" url="${backURI}" />
	</security:authorize>
	
	<security:authorize access="isAnonymous()">
		<acme:cancel code="challenge.goBack" url="${backURI}" />
	</security:authorize>
